<?php


declare(strict_types=1);

namespace app\common\trait;

/**
 * 模型 通用通信方法
 */
trait ResultTrait
{
    public function ok(string $msg = 'ok', array|object $data = [], int $code = 200): array
    {
        return std_result($code, $msg, $data);
    }

    public function fail(string $msg = 'fail', int $code = -1, array|object $data = []): array
    {
        return std_result($code, $msg, $data);
    }

    public function result(int $code = 200, string $msg = 'success', array|object $data = []): array
    {
        return std_result($code, $msg, $data);
    }
}
